<!--
 * @Author: your name
 * @Date: 2020-05-04 20:09:41
 * @LastEditTime: 2020-05-05 16:10:42
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \source\pages\code\DBLink\detail.vue
 -->
<template>
    <div class="detail">

        <Row>
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed>
<Filed :span="12" :name="l('link')">{{entity.link}}</Filed>
<Filed :span="12" :name="l('dbType')">{{entity.dbType}}</Filed>
<Filed :span="24" :name="l('note')">{{entity.note}}</Filed>
        </Row>
       
    </div>
</template>
<script>
    import Api from './api'
    export default {
        name: 'Add',
        data() {
            return {
                entity: {},
                rules: {
                    name: [{ required: true, message: '必填', trigger: 'blur' }],
                    code: [{ required: true, message: '必填', trigger: 'blur' }]
                }
            }
        },
        props: {
            eid: String
        },
        mounted() {
            if (this.eid.length > 0) {
                this.load(this.eid);
            }
        },
        methods: {
            load(v) {
                Api.get({ id: v }).then(r => {
                    this.entity = r.result;
                    this.$emit('on-load')
                })
            },
            handleClose() {
                this.$emit('on-close')
            },
      l(key) {
         let vkey = "DBLink" + "." + key;
          if(vkey==this.$t(vkey)){
               return this.$t(key)
          }else{
              return this.$t(vkey)
          }
      }
        },
        watch: {
            eid(v) {
                if (v.length > 1) {
                    this.load(v);
                }
            }
        }
    }
</script>